package com.yy.service.impl;

import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.function.Consumer;

/**
 * Author young
 * Date 2022/12/30 22:16
 * Description: SpringCloudAlibaba
 */
@Service
@Slf4j
public class ReceiveServiceImpl {
    @Bean
    public Consumer<Message<String>> myChannel(){
        return message-> {
            log.info("接收到的消息为：{}",DateUtil.format(LocalDateTime.now(), "yyyy年MM月dd日 HH:mm:ss")+message.getPayload());
        };
    }
}
